<!DOCTYPE html>
<html lang="zh-Hans-CN">
<head>
    <meta charset="UTF-8">
    <title> 注册局部组件 </title>
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="../vue.js"></script>
</head>
<body>
<h2>【例26】注册局部组件: new Vue({el: '#app',components: {}})</h2>
<hr>
<div id="app">
    <h3>注册局部组件</h3>
    <my组件></my组件>
</div>
<script>
    let com1 = {
        data() {
            return {name: "北京"}
        },
        template: '<p>我是vm实例中的局部组件。首都{{name}}</p>'
    };
    let vm = new Vue({
        el: '#app',
        components: {
            my组件: com1
        }
    })
</script>
<hr>
<p><a href="index.html">返回章节目录</a>
    <script>document.write(document.lastModified); </script>
</p>
</body>
</html>
